#ifndef __MESSAGEHANDLE_H__
#define __MESSAGEHANDLE_H__

#include <iostream>
#include <string>
#include <unistd.h>
#include <json-c/json.h>
#include <unordered_map>        //哈希表
#include <functional>           //function
#include "chatRoom.h"
#include "stdTcpServer.h"

using namespace std;

class MessageHandle
{

public:
    using HandleFunction = function<void(const string &)>;
    MessageHandle(const StdTcpSocketPtr & client);
    ~MessageHandle();

public:
    /* 处理信息 */
    void handleMessage(const string & msg);
    //void handleMessage(int to_friendConnfd);

private:

    ChatRoom m_chatroom;
    /* 函数映射表 */
    unordered_map<int, HandleFunction> m_handles;

};



#endif